// 1、给对象的属性添加类型注解
let person: {
  name: string;
  age: number;
};
person = {
  name: '张三',
  age: 29,
};

// 2、给对象的方法添加类型注解
let p1: {
  sayHi: () => void;
};
p1 = {
  sayHi() {
    console.log('哎哟，不错哟');
  },
};

let p2: {
  sing: (name: string) => void;
};
p2 = {
  sing(name: string) {
    console.log('歌曲名称：', name);
  },
};

let p3: {
  sum: (n1: number, n2: number) => number;
};
p3 = {
  sum(n1: number, n2: number) {
    return n1 + n2;
  },
};
